package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import usuario.ControladorUsuario;

/**
 * Servlet implementation class ServletUsandoAjax
 */
public class ServletUsandoAjax extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ServletUsandoAjax() {
        super();
       
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		
		String logusuario = request.getParameter("login");
		
		ControladorUsuario control = new ControladorUsuario();
		
		response.setContentType("text/xml");
		PrintWriter out = response.getWriter();
		
		String xml = "";
		
		xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"?>";
		xml = xml + "<resposta>\n";

		xml = xml + "<valido>";
		xml = xml +  control.verificaLogin(logusuario);
		xml = xml + "</valido>\n";	
				
		xml = xml + "</resposta>\n";

		out.write(xml);
		out.close();
		
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
	}

}
